
package com.uduew.sjd.ui.adapter;

import android.content.Context;

import androidx.recyclerview.widget.RecyclerView;

import com.uduew.sjd.R;
import com.uduew.sjd.databinding.LayoutImageBinding;
import com.uduew.sjd.utils.DiffUtils;
import com.kunminx.binding_recyclerview.adapter.SimpleDataBindingAdapter;

import java.io.File;


public class ImageAdapter extends SimpleDataBindingAdapter<File, LayoutImageBinding> {

    public static final int TYPE_CAMERA = 1;
    public static final int TYPE_PICTURE = 2;
    private int selectMax = 9;

//    private boolean isShowAddItem(int position) {
//        int size = getCurrentList().size();
//        return position == size;
//    }
//
//    @Override
//    public int getItemViewType(int position) {
//        if (isShowAddItem(position)) {
//            return TYPE_CAMERA;
//        } else {
//            return TYPE_PICTURE;
//        }
//    }

//    @Override
//    public int getItemCount() {
//        if (getCurrentList().size() < selectMax) {
//            return getCurrentList().size() + 1;
//        } else {
//            return getCurrentList().size();
//        }
//    }

    public ImageAdapter(Context context) {
        super(context, R.layout.layout_image, DiffUtils.getInstance().getImageItemCallback());
    }

    @Override
    protected void onBindItem(LayoutImageBinding binding, File item, RecyclerView.ViewHolder holder) {
        binding.setList(item);
        binding.setPlace(R.mipmap.ic_add_image);
    }
}
